var lis = document.querySelectorAll('li');
var items = document.querySelectorAll('.item')
for(var i = 0; i < lis.length; i++){
  lis[i].index = i;
  lis[i].onmouseenter = function(){
    this.className = 'active';
    var num = this.index;
    items[num].style.display = 'block';
  }
  lis[i].onmouseleave = function(){
    for(var j = 0; j < lis.length; j++){
      this.className = '';
      items[j].style.display = 'none';
    }
  }
}